1. Field of the Invention
The present invention relates to a bar code reading apparatus for decoding a character from bar code data read from a reflected light from a bar code expressing a character with bars having different widths.
2. Description of the Related Art
In recent years, the POS (Point of Sales) system is becoming increasingly popular so as to grasp the contents of sales of a product more quickly with less labor in retail shops such as convenience stores, department stores, and super markets. In such a POS system, there is placed a bar code reading apparatus for optically reading the bar code attached to a product expressing a character and decoding the character according to a result of reading operation.
There is sometimes a non-uniformity of bar widths in a bar code because of a difference in the printing precision, therefore there is a strong need in the bar code reading apparatus that it should execute high precision character decoding by not being affected by such a non-uniformity.
A bar code attached to a product (not shown), comprises a plurality of black bars and a plurality of white bars placed alternately, and expresses overall 20 types of characters from E(for Even)0 to E9 and O(for Odd) 0 to O9 described later.
As the bar code described above, there are bar code symbols defined as those for JAN (Japan Article Number), WPC (World Product Code) commonly available all over the world, EAN (European Article Number) used in Europe, and UPC (Universal Product Code) used in the United States.
FIG. 6 is a top view showing an example of a bar code 10. The bar code shown in this figure has, for instance, a black bar BB1, a white bar WB1, a black bar BB2, and a white bar WB2. Also the bar code 10 comprises a left block 11 expressing a product manufacturer code, a right block 12 expressing a product item code at the right side of the left block 11 with a center bar 13 therebetween, and a left guard bar 14 and a right guard bar 15 provided at the left edge of the left block 11 and at the right edge of the right block 12, respectively.
As shown in FIG. 7A to FIG. 7D, one character in the bar code 10 comprises four bars (elements), namely a first black bar, a second white bar, a third black bar, and a fourth white bar arrayed from the right side to the left side of the figure, and the character length (width) C (an inter-edge distance from the first black bar to the fourth white bar) is assumed as 7 modules (the unit length is described as xe2x80x9cmodulexe2x80x9d herein).
The bar code 10 basically expresses 10 types of figures (characters) from xe2x80x9c0xe2x80x9d to xe2x80x9c9xe2x80x9d with combinations of a black bar width B1 of the first black bar, a white bar width B2 of the second white bar, a black bar width B3 of the third black bar, and a white bar width B4, but as shown in FIG. 8, it is possible to express 20 types of characters with the same figures by introducing two types of combinations in which a total number of modules for black bars is regarded as an even number or an odd number.
Herein a bar code in which the total number of modules for black bars is an odd number is described as odd (simply described as O hereinafter) and a bar code in which the total number of modules for black bars is an even number is described as even (simply described as E hereinafter). In the case shown in FIG. 8, 10 types of characters in which a total number of modules for black bars indicating character O0 to character O9 is an odd number and 10 types of character in which a total number of modules for black bars indicating character E0 to character E9 is an even number, totally 20 types of characters are shown.
To describe by referring to the character O0 and character E0 as examples, the character O0 from the right side to the left side in the figure consists of a first black bar (one module), a black white bar (one module), a third black bar (two modules), and a fourth white bar (three modules). Thus, in the character O0, the sum of the number of modules for the first black bar (=1 module) and for the third black bar (=2 modules) is three modules which is an odd number.
On the other hand, the character E0 consists of, from the right side to the left side in the figure, a first black bar (three modules), a second white bar (two modules), a third black bar (one module), and a fourth white bar (one module). Thus, in the character E0, the sum of the number of modules for the first black bar (=3 modules) and for the third black bar (=1 module) is four modules which is an even number.
The character E4 shown in FIG. 7A consists of, from the right side to the left side in the figure, a one module black bar having the black bar width B1, a one module white bar adjoining the black bar and having the white bar width B2, a three modules black bar adjoining the white bar and having the black bar width B3, and a two modules white bar adjoining the black bar and having the white bar width B4.
Herein, a sum of the black bar width B1 and white bar width B2, namely the inter-edge distance between the first black bar and second white bar is called as delta distance T1, and in the example shown in the figure, the delta distance T1 is two modules. Further, a sum of the white bar width B2 and the black bar width B3, namely the inter-edge distance between the second white bar and the third black bar is called as delta distance T2, and in the example shown in the figure, this delta distance T2 is four modules.
The delta distance T1, delta distance T2, black bar width B1, and black bar width B3 are important parameters used to identify which of the characters O0 to O9 and characters E0 to E9 the character corresponds to.
Namely, as shown in FIG. 8, the delta distance T1 in each of the characters O0 to O9 is different from the delta distance T2 in each of the characters E0 to E9, so that the character is identified from the delta distance T1 and delta distance T2. In this operation for identifying a character, a first decoding table 100 of FIG. 10 showing a relation between combination patterns of the delta distance T1 and delta distance T2 and characters is used.
It should be noted that, in the characters E2 and E8, characters O2 and O8, characters O1 and O7, and characters E1 and E7, the delta distance T1 and delta distance T2 in each of the combinations are identical to each other, therefore as shown in FIG. 10, and the character cannot be identified from the delta distance T1 and delta distance T2.
To describe more specifically using the characters E2 and character E8 as examples, the delta distance T1 is three modules and also the delta distance T2 is three modules in both these characters, namely the two delta distances are equal to each other, so that to which of the characters E2 and character E8 the character to be identified corresponds to can not be identified only from the delta distance T1 and delta distance T2.
By using the fact that a black bar width for the first black bar and that for the third black bar are different from each other in the characters E2 and E8, character O2 and O8, characters O1 and O7, and characters E1 and E7, it is possible to identify the character from both or either one of the black bar widths.
To describe more specifically using the characters E2 and character E8 shown in FIG. 8 as examples, in the character E2, a black bar width of the first black bar is two modules, and a black bar width of the third black bar is two modules. On the other hand, in the character E8, a black bar width of the first black bar is one module, and a black bar width of the third black bar is one module, so that the black bar width in each bar of the character E8 is different from that in each bar of the character E2. Therefore, it is possible to identify the characters E2 and character E8 from the black bar width of the first black bar and that of the third black bar. It is needless to say that the character can be identified by checking the width of only one black bar.
To identify the characters O1 and E7, characters O2 and O8, characters E1 and E7, and characters E2 and E8 described above, each of which can not be identified even by using the first decoding table 100 (Refer to FIG. 10), a second decoding table 200 of FIG. 11 showing a relation between the combination patterns of the black bar width B1 of the first black bar and the black bar width B3 and characters is used.
In the conventional technology, a bar code reading apparatus is used as an apparatus for reading and also decoding the bar code 10 described above. This type of bar code reading apparatus generally comprises a reader for optically reading the bar code, and a CPU (Central Processing Unit) for decoding the characters expressed by the bar code 10.
Operation of a bar code reading apparatus based on the conventional technology is described with reference to the flow chart shown in FIG. 13. When the printing precision of the bar code 10 degrades, there exist thin black bars having a width narrower as compared to the width of a regular black bar and also thick black bars having a width wider as compared to the regular black bar.
To describe more specifically, FIG. 12B shows that the black bar width B1xe2x80x2 and black bar width B3xe2x80x2 are narrower as compared to the regular black bar width B1 and black bar width B3 (Refer to FIG. 12A), while FIG. 12C shows that the black bar width B1xe2x80x3 and black bar width B3xe2x80x3 are wider as compared to the regular black bar width B1 and black bar width B3 (Refer to FIG. 12A).
So the black bar widths B1xe2x80x2, B3xe2x80x2, B1xe2x80x3, B3xe2x80x3 or the like each include a printing error. Because of this error, it is difficult to determine an accurate number of modules. Therefore, there has been proposed a technology for correcting a black bar width of a character to be decoded by using a bar width of an already decoded character having a known number of modules.
Next, operation for decoding the decoded character E7 according to the decoded character E1 is described in FIG. 14. At first, the CPU (not shown herein) executes the step SA1 shown in FIG. 13 to compute the number of modules for each of the delta distance T1 and delta distance T2 in the character E7. In the example shown in FIG. 14, the CPU computes, from the equations (1) and (2) described below, the number of modules T1m for the delta distance T1 as four and the number of modules T2m for the delta distance T2 as four, and then shifts the processing to step SA2.
T1m=INT (T1/(Cz/7)+0.5)xe2x80x83xe2x80x83(1)
T2m=INT (T2/(Cz/7)+0.5)xe2x80x83xe2x80x83(2)
In the equations (1) and (2) described above, Cz indicates a length of a character to be decoded, while INT indicates rounding of the xe2x80x9cT1/(Cz/7)xe2x80x9d in the parenthesis.
Namely, INT indicates an operation for computing the number module as one when the values obtained through the expressions of xe2x80x9cT1/(Cz/7)+0.5xe2x80x9d and xe2x80x9cT2/(Cz/7)+0.5)xe2x80x9d are in the range from 0.5 to 1.5, as two when the above values are in the range from 1.5 to 2.5, as three when the above values are in the range from 2.5 to 3.5, as four when the above values are in the range from 3.5 to 4.5, and as five when the above values are 4.5 or more.
In step SA2, the CPU accesses the first decoding table 100 shown in FIG. 10 to decode the characters, and then shifts the processing to step SA3. In this case, the delta distance T1 is four modules and also the delta distance T2 is four modules, so that the CPU regards a result of decoding as the character E1 or character E7. In this case, as the decoded character is either the character E1 or character E7, so that the decoded character can not be identified.
When the characters are identified as the characters E(O)1, E(O)7, E(O)2, and E(O)8, the character cannot be decoded by referring to only the first decoding table 100, and in that case the character decoding must be executed by using the second decoding table 200 (Refer to FIG. 11).
Hereinafter the characters E(O)1, E(O)7, E(O)2 and E(O)8 (shown simply as 1, 7, 2, and 8 in FIG. 13) as corrected characters. In the corrected characters, an error in the width of a black bar must be corrected to prevent the influence of the narrower or wider bar code 10 as compared to the width of a regular bar.
In step SA3, the CPU determines whether the character decoded in step SA2 is a corrected character or not, and when a result of determination is xe2x80x9cNOxe2x80x9d, the CPU shifts the processing to step SA7. If a result of determination in step SA3 is xe2x80x9cNOxe2x80x9d, it indicates that character decoding has been completed with the first decoding table 100. In this case, as the character is a corrected character (either one of character E1 and character E7), the CPU regards a result of determination in step SA3 as xe2x80x9cYESxe2x80x9d, and shifts the processing to step SA4.
In step SA4, to prevent influence generated when a width of the bar code 10 becomes narrow or wide as compared to the regular one because of the degradation in the printing precision, the CPU corrects the black bar width B1 shown in FIG. 14 by referring to the reference black bar width X as a reference, and then shifts the processing to step SA5.
In step SA5, the CPU computes the number of modules for the reference black bar width X (described as reference black bar width module number Xm hereinafter), and then computes the number of modules for the corrected black bar width B1 according to the result of computing as well as to the method of determination as shown in FIG. 9.
Namely, the CPU computes the number of modules for the corrected black bar width B1 by subtracting a width difference xcex94X (a difference between the number of modules for the reference black bar width X and the number of modules for the black bar width B1) from the reference black bar width number of modules number Xm and according to the determination method shown in FIG. 9. Also the CPU computes the number of modules for the corrected black bar width B3 according to the same procedure as that used when computing the number of modules for the black bar width B1, and then shifts the processing to step SA6.
In step SA6, the CPU applies the black bar width B1 and black bar width B3 to the second decoding table 200 (Refer to FIG. 11) to identify a character, and then shifts the processing to step SA7. In step SA7, the CPU computes a module number for the black bar width B1 for decoding the next characters by regarding the black bar width B1 as the reference black bar width X and finishes the character decoding.
By the way, the bar width correcting method in a bar code reading apparatus based on the conventional technology is effective when narrowing or widening of bars due to an error generated when a bar code is printed appears homogeneously. However, when narrowing and widening of bars due to a printing error does not appear homogeneously like in a case where length (width) of each character in a bar code is different from each other an error is generated when the bar widths are corrected.
Because of this problem, in the step SA6 shown in FIG. 13, when the black bar width B1 (=1 module) and black bar width B3 are applied to the second decoding table 200 (Refer to FIG. 11), as clearly shown in the figure, any corresponding character does not exist, so that decoding can not be executed. This is caused by the fact that it is generally assumed in the bar code reading apparatus based on the conventional technology that narrowing or widening of black bars appears at the same ratio throughout a bar code and that correction is executed by referring the reference black bar width X as a reference.
Namely, in the example shown in FIG. 14, there is a difference between length (width) of the decoded character Cy (=198 counts) and length (width) of a character to be decoded Cz (=211), and because of this non-uniformity in length of the character in the bar code 10, an error is generated in the decoding described above, especially in correction of bar width in each character to be decoded.
The present invention was made under the circumstances as described above, and it is an object of the present invention to provide a bar code reading apparatus which can execute character decoding without being affected by non-uniformity in width of each character in a bar code and a method for the same.
According to the present invention, a ratio computing unit computes a ratio between a character width of an already decoded character and that of a character to be decoded, and when this ratio is greater than a threshold value, a first correcting unit corrects a bar width of bars each constituting a character to be decoded by referring to a bar width of the reference bar corrected by the second correcting unit, so that character decoding can be executed correctly without being affected by a non-uniformity in a width of each character expressed by a bar code.
When the width of each character in a bar code changes at the same ratio, a difference between a character width of an already decoded character and that of a character to be decoded is not generated, so that a ratio computed by the ratio computing unit is less than the threshold value.
When the ratio is less, the first correcting unit corrects the bar width of each bar constituting the character to be decoded by referring to a bar width of a reference bar not corrected by the second correcting unit. Then, decoding of the character to be decoded is executed by a decoding unit according to a bar width of the already decoded character.
On the other hand, when widths of characters in a bar code change at different ratios a difference is generated between the widths of the already decoded characters and those of characters to be decoded, so that a ratio computed by the ratio computing unit is greater (hereinafter greater shall mean greater or equal to) than the threshold value.
When the ratio is greater, the first correcting unit corrects a bar width of bars each constituting the character to be decoded. Then, the characters to be decoded are decoded by the decoding unit according to the bar width of the already decoded character.
According to the present invention, a printing precision computing unit computes the printing precision of a bar code, and when the printing precision is lower than a threshold value, a first correcting unit corrects a bar width of bars each constituting a character to be decoded according to a bar width of the reference bar corrected by the second correcting unit, so that character decoding can correctly be executed without being affected by a non-uniformity in a width of each character in a bar code.
When the printing precision in a bar code degrades (when a width of each character changes at a different ratio respectively), the first correcting unit corrects a bar width of bars each constituting a character to be decoded according to a bar width of the reference bar corrected by the second correcting unit. Then, decoding of the character to be decoded is executed by a decoding unit according to a bar width of the already decoded character.
According to the present invention, the printing precision computing unit computes printing precision by comparing a bar width of at least reference bar in the already decoded character to that of the character to be decoded.
Even when the printing precision which is a ratio between a character width of the already decoded character and that of the character to be decoded changes the character decoding can correctly be executed without being affected by a non-uniformity in a width of each character in a bar code.
According to the present invention, a ratio between a character width of an already decoded character and that of a character to be decoded is computed, and when the ratio is greater than a threshold value, in a first correcting step, a correction of the bar width of bars each constituting the character to be decoded is executed by referring to a bar width of the reference bar corrected in a second correcting unit, so that character decoding can correctly be executed without being affected by a non-uniformity in a width of each character in a bar code.
When the width of each character in a bar code changes at the same ratio a difference between a character width of the already decoded character and that of a character to be decoded is not generated, so that the ratio computed in the ratio computing step is less than the threshold value.
When the ratio is less, in the first correcting step the bar width of bars each constituting a character to be decoded is corrected according to a bar width of the reference bar not corrected in the second correcting step. Then, decoding of the character to be decoded is executed in the decoding step according to a bar width of the already decoded character.
On the other hand, when a width of each character in a bar code changes at a different ratio respectively a difference is generated between the widths of the already decoded characters and those of the character to be decoded, so that the ratio computed in the ratio computing step is greater than the threshold value.
When the ratio is greater, in the first correcting step, correction of a bar width of characters each constituting a character to be decoded is executed according to a bar width of the reference bar corrected in the second correcting step. Then, the character to be decoded is decoded in the decoding step according to the bar width of the already decoded character.
According to the present invention, when printing precision in a bar code is degraded (when a width of each character changes at a different ratio respectively), in a first correcting step the correction of a bar width of bars each constituting a character to be decoded is executed according to a bar width of the reference bar corrected in a second correcting step. Then, the character to be decoded is decoded in the decoding step according to the bar width of the already decoded character.
Thus, the printing precision of a bar code is computed and when the printing precision worst than a threshold value, in the first correcting step correction of a bar width of bars each constituting a character to be decoded is executed according to a bar width of the reference bar corrected in the second correcting step, so that character decoding can correctly be executed without being affected by a non-uniformity of a width of each character in a bar code.
According to the present invention, in the printing precision computing step, printing precision is computed by comparing a width of at least one reference bar in the already decoded character to that of a character to be decoded.
Thus, even when the printing precision which is a ratio between a width of the already decoded character and that of a character to be decoded changes, the character decoding can correctly be executed without being affected by the non-uniformity of a width of each character in a bar code.
Other objects and features of this invention will become apparent from the following description with reference to the accompanying drawings.